package com.jinhongone.pattern.behavior.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * @author jinho
 * @className StudentAggregateImpl
 * @description 具体聚合类
 * @date 2025/4/17 9:05
 */
public class StudentAggregateImpl implements StudentAggregate {

    private List<Student> students = new ArrayList<>();

    @Override
    public void addStudent(Student stu) {
        students.add(stu);
    }

    @Override
    public void removeStudent(Student stu) {
        students.remove(stu);
    }

    @Override
    public StudentIterator getStudentIterator() {
        return new StudentIteratorImpl(students);
    }
}
